<?php

/**
 * Quote form.
 *
 * @package    quotes
 * @subpackage form
 * @author     Your name here
 */
class SearchForm extends sfForm
{
  const ALL = 'ALL';
  const AUTHORS = 2;
  const QUOTES = 1;
  
  public function configure()
  {
    $this->widgetSchema['keywords'] = new sfWidgetFormInput(array(), array('class' => 'autocomplete_box'));
    $this->setDefault('keywords', $this->getOption('def'));
    $this->widgetSchema['type'] = new sfWidgetFormChoice(array('choices' => self::$types, 'default' => $this->getOption('type_def', self::ALL), 'expanded' => true));
    $this->widgetSchema['page'] = new sfWidgetFormInputHidden(array('default' => 1));
    
    $this->widgetSchema->setNameFormat('search[%s]');
  }
  
  public static $types = array(
    self::ALL => 'All',
    self::AUTHORS   => 'Authors',
    self::QUOTES   => 'Quotes'
  );  
}
